package com.taxshare.tools.util;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;


/**
 * CREATE TIME：2020/3/17 - 9:15
 */

/**
 * 1、实现 对象 转 xml
 * 2、实现 xml 转对象
 */
public class XmlInterfaceUtils {

    private XmlInterfaceUtils() {

    }

    /**
     * xml 转 对象
     *
     * @param clazz
     * @param xmlStr
     * @return
     * @throws Exception
     */
    public static Object XmltoBean(String xmlStr, Class<?> clazz) throws JsonProcessingException {
        XmlMapper mapper = new XmlMapper();
        return mapper.readValue(xmlStr, clazz);
    }

}